package leetcode;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

/**
 * @author LiDong
 * @version 1.0.0
 * @createTime 2/20/2022 9:19 AM
 */
@Slf4j
public class Test326 {

    @Test
    public void test() {
        boolean powerOfThree = isPowerOfThree(27);
        log.info(String.valueOf(powerOfThree));
    }


    public boolean isPowerOfThree(int n) {
        while (n != 0 && n % 3 == 0) {
            n /= 3;
        }
        return n == 1;
    }


}
